package com.hutao.sso.service.impl.hospital;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hutao.sso.dataSource.TargetDataSource;
import com.hutao.sso.mapper.newAuthority.UserHospitalsMapper;
import com.hutao.sso.pojo.newAuthority.UserHospitals;
import com.hutao.sso.service.hospital.UserHospitalService;
import com.hutao.sso.util.StringUtil;

@Transactional
@Service
public class UserHospitalServiceImpl implements UserHospitalService{

	@Autowired
	private UserHospitalsMapper userHospitalsMapper;
	
	@TargetDataSource(name = "ds1")
	@Transactional
	@Override
	public List<UserHospitals> findUserHospitalsListPage(Map<String, Object> params) {
		return userHospitalsMapper.findUserHospitalsListPage(params);
	}

	@TargetDataSource(name = "ds1")
	@Transactional
	@Override
	public long findUserHospitalsCount(Map<String, Object> params) {
		return userHospitalsMapper.findUserHospitalsCount(params);
	}

	@TargetDataSource(name = "ds1")
	@Override
	public int saveUserHospitals(UserHospitals userHospitals) {
		userHospitals.setId(StringUtil.getId());
		return userHospitalsMapper.saveUserHospitals(userHospitals);
	}

	@TargetDataSource(name = "ds1")
	@Transactional(readOnly = true)
	@Override
	public long findUserHospitalsByLoginNameAndMedicalMainstayId(Map<String, Object> params) {
		return userHospitalsMapper.findUserHospitalsByLoginNameAndMedicalMainstayId(params);
	}

	@TargetDataSource(name = "ds1")
	@Override
	public int updateUserHospitalByIsAcvicateAndId(Map<String, Object> params) {
		return userHospitalsMapper.updateUserHospitalByIsAcvicateAndId(params);
	}

	@TargetDataSource(name = "ds1")
	@Override
	public int updatePasswordById(Map<String, Object> params) {
		return userHospitalsMapper.updatePasswordById(params);
	}

	@TargetDataSource(name = "ds1")
	@Override
	public int updateUserNameByAndOfficeIdId(Map<String, Object> params) {
		return userHospitalsMapper.updateUserNameAndOfficeCodeById(params);
	}

	

}


